package com.gy.bearhelps.handle.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gy.bearhelps.R;
import com.gy.bearhelps.handle.bean.HandleDetailBean;

import java.util.List;

/**
 * Created by 高岳 on 2016/11/9.
 * Describe:办理流程详情下载列表的adapter
 */
public class HandleDetailFileAdapter extends BaseAdapter {

    private Context context;
    private List<HandleDetailBean.FileListBean> list;

    public HandleDetailFileAdapter(Context context, List<HandleDetailBean.FileListBean> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.adapter_handle_file,null);
        TextView tvName = (TextView) convertView.findViewById(R.id.adapter_handle_file_tv_name);
        String fileName = list.get(position).fileName;
        if(fileName.indexOf(".") != -1){
            fileName = fileName.substring(0,fileName.indexOf("."));
        }
        tvName.setText("《"+ fileName +"》下载");
        return convertView;
    }
}
